package com.cltech.frame.specification.utils;

import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

/**
 * Created by Administrator on 2019/4/17.
 */
@Getter
public enum  QueryRuleEnum {
    GT("GreaterThan","大于"),
    GE("GreaterEqual","大于等于"),
    LT("LessThan","小于"),
    LE("LessEqual","小于等于"),
    EQ("Equal","等于"),
    NE("NotEqual","不等于"),
    IN("In","包含"),
    NOT_IN("NotIn","包含"),
    LIKE("Like","全模糊"),
    NOT_LIKE("NotLike","不全模糊"),
    STARTS_WITH("StartsWith","左模糊"),
    END_SWITH("EndsWith","右模糊"),
    ORDER_BY_ASC("asc","升序"),
    ORDER_BY_DESC ("desc","降序");

    private String value;

    private String msg;

    QueryRuleEnum(String value, String msg){
        this.value = value;
        this.msg = msg;
    }
    public static QueryRuleEnum getByValue(String value){
        if(StringUtils.isEmpty(value)) {
            return null;
        }
        for(QueryRuleEnum val :values()){
            if (val.getValue().equals(value)){
                return val;
            }
        }
        return  null;
    }
}
